package cn.dkk.behavior_design.interpret;

/**
 * @author dkk
 * @date 2022/8/1
 * @desc
 */
public class Test {
    public static void main(String[] args) {
        Context context = new Context();
        Variable a = new Variable("a");
        Variable b = new Variable("b");
        Variable c = new Variable("c");
        Variable d = new Variable("d");
        context.assign(a,1);
        context.assign(b,2);
        context.assign(c,3);
        context.assign(d,4);

        AbstractExpression expression = new Plus(d,new Plus(c,new Minus(a,b)));

        int interpret = expression.interpret(context);
        System.out.println(interpret);
        System.out.println(expression);
    }
}
